package co.yixiang.modules.adopt.entity.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import co.yixiang.common.annotation.Sensitive;
import co.yixiang.common.domain.BaseDomain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
@TableName(value = "yx_adopt_feature")
public class YxAdoptFeature extends BaseDomain {
    /** ID */
    @TableId
    private Long id;

    /** 菜单名称 */
    @NotBlank(message = "请填写特点名称")
    private String name;

    /** 菜单名称 */
    @NotBlank(message = "请填写描述信息")
    @TableField(value = "`desc`")
    private String desc;

    /** 排序 */
    @NotNull(message = "排序不能为空")
    private Long sort;

    /** 图标 */
    @Sensitive
    private String icon;

    /** 是否隐藏 */
    private Boolean hidden;

    public void copy(YxAdoptFeature source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
